<template>
  <div class="wrap">
    <input type="text" class="form-control" v-model="value">
    <button class="btn" type="button" @click="handleAdd">添加</button>
  </div>
</template>


<script setup>
import { ref, defineEmits, defineProps } from 'vue';
const props = defineProps({
  list: {
    type: Array,
    default: () => []
  }
})

const value = ref('')
const emits = defineEmits(['update:list']) // update: *   固定语法

const handleAdd = () => {
  const arr = props.list
  arr.push(value.value)

  emits('update:list', arr)
  value.value = ''
}
</script>

<style>

</style>